package com.qf.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.pojo.DtsGoods;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 商品基本信息表 Mapper 接口
 * </p>
 *
 * @author zhaojian
 * @since 2021-05-12
 */
public interface DtsGoodsMapper extends BaseMapper<DtsGoods> {

    //查询符合条件的商品的总条数
    @Select("select  count(1)\n" +
            "from dts_goods dg \n" +
            "inner join  dts_brand db  on db.id=dg.brand_id\n" +
            "where db.admin_id = #{id} ")
    Long findGoodsListCount(Integer id);
    //查询符合条件的商品分页集合
    @Select("select  dg.* \n" +
            "from dts_goods dg \n" +
            "inner join  dts_brand db  on db.id=dg.brand_id\n" +
            "where db.admin_id = #{id}  limit #{startRow},#{limit} ")
    List<DtsGoods> findGoodPageByAdminId(@Param("id") Integer id,
                                         @Param("startRow")Integer startRow, @Param("limit")Integer limit);
}
